package www.tshu.listener;

import www.tshu.pojo.Typee;
import www.tshu.service.BookService;
import www.tshu.service.impl.BookServiceImpl;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.util.List;

@WebListener
public class BookTypeListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        BookService bookService = new BookServiceImpl();
        List<Typee>tlist = bookService.getTypeList();
        servletContextEvent.getServletContext().setAttribute("tlist",tlist);
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
